package proxy01;

public class Proxy implements CompanyA,CompanyB  {
//    private PersonA personA;
    private CompanyA companyA;
    private CompanyB companyB;

    public CompanyB getCompanyB() {
        return companyB;
    }

    public void setCompanyB(CompanyB companyB) {
        this.companyB = companyB;
    }

    public CompanyA getCompanyA() {
        return companyA;
    }

    public void setCompanyA(CompanyA companyA) {
        this.companyA = companyA;
    }

    @Override
    public void sale(String s) {
        doBefore();
        companyA.sale(s);
        doAfter();
    }
    private void doBefore(){
        System.out.println("售前服务。。。");
    }

    private void doAfter(){
        System.out.println("售后服务。。。");
    }

    @Override
    public void saleb(String a) {
        doBefore();
        companyB.saleb(a);
        doAfter();
    }
}
